package com.bankcard.bininfo.model;

import java.util.Objects;

/**
 * Represents the country information associated with a card issuer.
 */
public class CountryInfo {
    /**
     * The ISO country name.
     */
    private final String isoCountryName;

    /**
     * The ISO 3166-1 alpha-2 country code.
     */
    private final String isoCountryCodeA2;

    /**
     * The ISO 3166-1 alpha-3 country code.
     */
    private final String isoCountryCodeA3;

    /**
     * The ISO currency code of the country.
     */
    private final String isoCountryCurrency;

    /**
     * Constructs a new CountryInfo instance.
     *
     * @param isoCountryName the ISO country name
     * @param isoCountryCodeA2 the ISO 3166-1 alpha-2 country code
     * @param isoCountryCodeA3 the ISO 3166-1 alpha-3 country code
     * @param isoCountryCurrency the ISO currency code of the country
     */
    public CountryInfo(String isoCountryName, String isoCountryCodeA2, String isoCountryCodeA3, String isoCountryCurrency) {
        this.isoCountryName = isoCountryName;
        this.isoCountryCodeA2 = isoCountryCodeA2;
        this.isoCountryCodeA3 = isoCountryCodeA3;
        this.isoCountryCurrency = isoCountryCurrency;
    }

    public String getIsoCountryName() {
        return isoCountryName;
    }

    public String getIsoCountryCodeA2() {
        return isoCountryCodeA2;
    }

    public String getIsoCountryCodeA3() {
        return isoCountryCodeA3;
    }

    public String getIsoCountryCurrency() {
        return isoCountryCurrency;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        CountryInfo that = (CountryInfo) o;
        return Objects.equals(isoCountryCodeA2, that.isoCountryCodeA2);
    }

    @Override
    public int hashCode() {
        return Objects.hash(isoCountryCodeA2);
    }

    @Override
    public String toString() {
        return "CountryInfo{" +
                "isoCountryName='" + isoCountryName + '\'' +
                ", isoCountryCodeA2='" + isoCountryCodeA2 + '\'' +
                ", isoCountryCodeA3='" + isoCountryCodeA3 + '\'' +
                ", isoCountryCurrency='" + isoCountryCurrency + '\'' +
                '}';
    }
}